/**
* @file system.h
* @brief system define and function
* @details 
* @author huangbin
* @version V1.0.0
* @date 2025-04-20
* @copyright All documents are copyrighted by Shenzhen Xinlongwei Technology Co., LTD.
*            They may not be used for commercial purposes without permission
*/

#ifndef __SYSTEM_H__
#define	__SYSTEM_H__
#include "inc.h"

#ifdef __cplusplus
 extern "C" {
#endif /* __cplusplus */
////////////////////////////////////////////////////////////////////////////////////

/**
* @brief system clock config
*/  
extern void RCC_ClkConfiguration(void);

/**
* @brief watchdog initial
*/  
extern void WatchDogInit(void);

/**
* @brief feed dogs
*/  
extern void WatchDogFeed(void);

/**
* @brief delay microsecond
* @param[in] ms delay time
*/  
extern void SoftwareDelayMs(uint32_t ms);

/*!
 * \brief delay specified time in microsecond
 * \param[in] wUs time in microsecond
 */
//extern void delay_us(uint32_t wUs);
#define HardWareDelay_us(wUs) delay_us(wUs)
/*!
 * \brief delay specified time in millisecond
 * \param[in] wMs time in millisecond
 */
//extern void delay_ms(uint32_t nMs);
#define HardWareDelay_ms(nMs) delay_ms(nMs)

#define System_tick_test_start() start_cycle_counter()
//static inline int64_t stop_cycle_counter(void);
#define System_tick_test_stop()  stop_cycle_counter()

/*!
 * \brief 获取芯片内置Flash的容量
 * \return 以KB为单位的容量
 */
extern uint16_t GetFlashCapacity(void);

/*!
 * \brief 读取96bit芯片id
 * \param[in] c95_64 保存[95:64]bit 
 * \param[in] c63_32 保存[63:32]bit 
 * \param[in] c31_00 保存[31:00]bit 
 */
extern void GetChipId(uint32_t* c95_64,uint32_t* c63_32,uint32_t* c31_00);

/*!
 * \brief 重映射Jtag IO：PA13,PA14 for sw-dp,pa15,pb3,pb4 for io
 */
extern void JtagRemap(void);
///////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif
/************************END OF FILE*********************************************/
